<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>

<%@ page import="fr.mywiki.view.web.struts.form.ErrorMessageForm" %>

<script>
<!--
function log() {
	document.forms["accountLogForm"].method.value='log';
	document.forms["accountLogForm"].submit();
}

function unlog() {
	document.forms["accountLogForm"].method.value='unlog';
	document.forms["accountLogForm"].submit();
}

function logUser(e) {
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	if (keycode == 13) {
		log();
	}
}
-->
</script>

<html:form action="accountLog"> 
	<html:hidden property="method" value="display" />
	
	<p>
		<logic:notEmpty property="login" name="accountLogForm"> 
			<bean:write property="login" name="accountLogForm" /> 
			<a href="javascript:unlog();">
				<bean:message key="log.unlog"/>
			</a>
		</logic:notEmpty>
		
		<logic:empty property="login" name="accountLogForm">
			<bean:message key="log.login"/>
			<html:text name="accountLogForm" property="login" onkeypress="logUser(event);"/>
			<bean:message key="log.password"/>
			<html:password name="accountLogForm" property="password" onkeypress="logUser(event);"/>
			<a href="javascript:log();">
				<bean:message key="log.log"/>
			</a>
		</logic:empty>
	</p>
	
	<%ErrorMessageForm errorForm = (ErrorMessageForm) session.getAttribute("accountLogForm"); %>
	<%@include file="./error.jsp"%>
</html:form>
